const express = require("express");
const app = express();
const db = require("./db/index");

const sqlstr = "select * from students";
let arr = [];
db.query(sqlstr, (err, result) => {
  if (err) return console.log("连接错误" + err.message);
  arr = Array.from(result);
});

app.get("/", function (req, res) {
  res.send(arr);
});
app.listen(3000);
